<?php
defined('IN_TS') or die('Access Denied.');

$userid = aac('user')->isLogin();

$taskid	= intval($_POST['taskid']);
$content	= tsClean($_POST['content']);

$text = strip_tags($_POST['content'],'<img>');

if($text == ''){
	tsNotice('评论内容不能为空');
}


if($TS_USER['isadmin']==0){
	//过滤内容开始
	aac('system')->antiWord($content);
	//过滤内容结束
}

$commentid = $new['task']->create('task_comment',array(
	'taskid'			=> $taskid,
	'userid'			=> $userid,
	'content'	=> $content,
	'addtime'		=> time(),
));

$strTask = $new['task']->getTaskByTaskid($taskid);
if($strTask['userid'] != $TS_USER['userid']){
	$msg_userid = '0';
	$msg_touserid = $strTask['userid'];
	$msg_content = '你发布的任务《'.$strTask['title'].'》新增一条评论，快去看看吧^_^ ';
	$msg_tourl = tsUrl('task','show',array('id'=>$taskid));
	aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl);
}

header("Location: ".tsUrl('task','show',array('id'=>$taskid)));